package talk.Data;

import talk.Bean.User;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by debby on 2018/4/2.
 * 描述:数据库
 */

public class SQL {

    private static Map<String, User> users = new HashMap<>();
    public static List<User> userList = new ArrayList<>();

    static {
        User user1 = new User("00000", "叶叶树梓", "904028997", Constant.path);
        User user2 = new User("00001", "debby", "1314", Constant.path);
        User user3 = new User("00002", "亮总", "123456", Constant.path);
        User user4 = new User("00003", "黯夜朔光", "123456", Constant.path);
        User user5 = new User("00004", "林梓", "123456", Constant.path);
        User user6 = new User("00005", "黑色幻影", "123456", Constant.path);

        users.put("叶叶树梓", user1);
        users.put("debby", user2);
        users.put("亮总", user3);
        users.put("黯夜朔光", user4);
        users.put("林梓", user5);
        users.put("黑色幻影", user6);

        userList.add(user1);
        userList.add(user2);
        userList.add(user3);
        userList.add(user4);
        userList.add(user5);
        userList.add(user6);

    }

    public static Boolean login(String name, String password) {
        return users.get(name) != null && users.get(name).getPassword().equals(password);
    }

    public static User getUser(String name) {
        return users.get(name);
    }
}
